<?php
	class AdminWebserviceController extends Zone_Action{
		public function fields( $default=NULL ){
			return array(
				smtp_host => array(
					type 		=> 'CHAR',
					form_label  => 'smtp_host'
				),
				smtp_port => array(
					type 		=> 'CHAR',
					form_label  => 'smtp_port'
				),
				smtp_email => array(
					type 		=> 'CHAR',
					form_label  => 'smtp_email'
				),
				smtp_password => array(
					type 		=> 'CHAR',
					form_label  => 'smtp_password'
				),
				sms_src => array(
					type 		=> 'CHAR',
					form_label  => 'sms_src'
				),
				sms_mtsqe => array(
					type 		=> 'CHAR',
					form_label  => 'sms_mtsqe'
				),
				sms_moid => array(
					type 		=> 'CHAR',
					form_label  => 'sms_moid'
				),
				sms_moseq => array(
					type 		=> 'CHAR',
					form_label  => 'sms_moseq'
				),
				sms_cmdcode => array(
					type 		=> 'CHAR',
					form_label  => 'sms_cmdcode'
				),
				sms_cpid => array(
					type 		=> 'CHAR',
					form_label  => 'sms_cpid'
				),
				sms_opid => array(
					type 		=> 'CHAR',
					form_label  => 'sms_opid'
				),
				sms_url => array(
					type 		=> 'CHAR',
					form_label  => 'sms_url'
				),
				sms_username => array(
					type 		=> 'CHAR',
					form_label  => 'sms_username'
				),
				sms_password => array(
					type 		=> 'CHAR',
					form_label  => 'sms_password'
				),
				sms_msgtitle => array(
					type 		=> 'CHAR',
					form_label  => 'sms_msgtitle'
				)
			);
		}
				
		
		public function indexAction(){
			//ini_set("soap.wsdl_cache_enabled","0");
			//$server = new SoapServer("hello.wsdl");
			$post = $this->Model->fetchRow("SELECT * FROM `configs` LIMIT 1");
	/* 	$html = "";
			foreach($post as $p => $v){
				$html .="\n{$p} => array(
					type 		=> 'CHAR',
					form_label  => '{$p}'
				),";
			}
			
			die($html); */
			
			$this->set('post',$post);
			if(isPost()){
				loadClass('ZData');
				$f = new ZData();
				$f->addField( $this->fields($post));
				$data = $f->getData();
				$this->setJSON(array(
					message	=> success('Ðã cập nhập thành công')
				));
				$this->Model->removeCache("configs");
			}
		}		
	}
 ?>